import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:umeng_apm_sdk/umeng_apm_sdk.dart';
import 'package:sports_new/controller/match/list/match_page_logic.dart';
import 'package:sports_new/controller/match/list/zq_match_filter_logic.dart';
import 'package:sports_new/controller/match/list/zq_view_logic.dart';
import 'package:sports_new/controller/service/config_service.dart';
import 'package:sports_new/entity/match/zq_list_entity.dart';
import 'package:sports_new/utils/constant.dart';

class ZqNotBeginLogic extends GetxController implements MatchListProvider {
  final filter =
      Get.find<ZqMatchFilterLogic>(tag: Constant.matchFilterTagSchedule);
  int index = 0;
  QuickFilter quickFilter = QuickFilter.all;
  bool isBottomHide = false;
  int hideMatchNum = 0;
  final ScrollController scrollC = ApmScrollController();

  @override
  void onInit() {
    super.onInit();
    if (Get.find<ConfigService>().zqConfig.zqAlert7 == 1) {
      quickFilter =
          Get.find<ZqViewLogic>(tag: Constant.matchFilterTagAll).quickFilter;
    }
  }

  void changeIndex(newIndex) {
    index = newIndex;

    try {
      //可能未初始化找不到controller
      final scheduleListController = Get.find<ZqViewLogic>(
          tag: '${Constant.matchFilterTagSchedule}$newIndex');
      filter.clearLeague();
      filter.initLeague(ZqMatchType.schedule);
      scheduleListController.filterMatch(filter.getHideLeagueIdList());
    } catch (e) {}
  }

  selectMatchType(QuickFilter type, {bool fromFilterPage = false}) {
    quickFilter = type;
    final listController =
        Get.find<ZqViewLogic>(tag: '${Constant.matchFilterTagSchedule}$index');

    listController.onSelectMatchType(type, fromFilterPage: fromFilterPage);
  }

  void onCloseBottomBar() {
    isBottomHide = true;
    update();
  }

  void onShowBottom() {
    isBottomHide = false;
    update();
  }

  @override
  Future doRefresh() {
    // TODO: implement doRefresh
    throw UnimplementedError();
  }

  @override
  Future getMatch() {
    // TODO: implement getMatch
    throw UnimplementedError();
  }

  @override
  String getTicketName(ZqListEntity match) {
    // TODO: implement getTicketName
    throw UnimplementedError();
  }

  @override
  updateView() {
    // TODO: implement updateView
    throw UnimplementedError();
  }
}
